package modelnew;

public class Field {

	// Data Members
	
	// The Susan Field
	public int[] field = 
		   {0,0,0,0,0,0,0,0,0,0,0,
			0,4,4,4,4,4,0,0,0,0,0,
			0,4,4,4,4,4,4,0,0,0,0,
			0,4,4,4,4,4,4,4,0,0,0,
			0,4,4,4,4,4,4,4,4,0,0,
			0,4,4,4,4,4,4,4,4,4,0,
			0,0,4,4,4,4,4,4,4,4,0,
			0,0,0,4,4,4,4,4,4,4,0,
			0,0,0,0,4,4,4,4,4,4,0,
			0,0,0,0,0,4,4,4,4,4,0,
			0,0,0,0,0,0,0,0,0,0,0,};
	
	// Static decelerations
	
	// The value of field is a bitmask:
	public static final int fieldplayer = 1; // 0 for player 1, 1 for player 2
	public static final int fieldoccupied = 2; // occupied by a player's stone
	public static final int fieldexists = 4; // field exists
	public static final int fielddontcare = 8; // don't take care of this stone
												// in db entry
	public static final int fieldmarkdrag = 16; // marked for a valid drag
	public static final int fieldmarklost = 32; // the game is lost because of
												// this stone
	public static final int fieldmarkfort = 64; // field is protected by an arc
	public static final int fieldmarklooser = 128; // this own stone is enclosed
													// by 5 others
	public static final int fieldmarkvictim = 256; // this opponent's stone is
													// enclosed by 5 others
	public static final int fieldmarkcalc = 512; // this field could be
													// interesting for move
													// precalculation
	public static final int fieldtemp = 1024; // temporarily used bit
	public static final int fieldtemp2 = 2048; // temporarily used bit

	// This lets us easily use bitwise operations to check and change the status
	// of fields:
	public static final int fieldexoccupied = 6; // mask: occupied, exists
	public static final int fieldexoccupiedno = 4; // not occupied, but exists
	public static final int fieldexoccupiedyes = 6; // occupied and exists
	public static final int fieldexoccpl = 7; // mask: player, occupied, exists
	
	// The magic field index
	// This field is used as noField-value
	public static final int magicfield=19;
	
	// The stones around a field
	public static final int around[]={-12,-11,-1,1,11,12};
	
	// Methods
	public int get(int i) {
		return field[i];
	}
}
